package com.qf.chinatelcom.smsatragety.mq.listener;

import com.qf.chinatelcom.smsatragety.service.SmsManagerService;
import com.qianfeng.smsplatform.common.constants.RabbitMqConsants;
import com.qianfeng.smsplatform.common.model.Standard_Submit;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component//让spring为我们创建这个对象,这个地方相当于controller
public class SmsListener {

    private SmsManagerService smsManagerService;

    @Autowired
    public void setSmsManagerService(SmsManagerService smsManagerService) {
        this.smsManagerService = smsManagerService;
    }

    @RabbitListener(queues = RabbitMqConsants.TOPIC_PRE_SEND)
    public void OnMessage(Standard_Submit submit) {

        smsManagerService.deal(submit);

    }
}
